﻿using Microsoft.AspNetCore.Mvc;
using System.Threading.Tasks;
using Volo.Abp.Application.Dtos;
using Xms.Abp.Application.Dtos;
using Xms.Abp.Application.Services;

namespace Xms.Abp.AspNetCore.Mvc;

public abstract class XmsReadOnlyPageController<TService, TEntityDto, TKey>
    : XmsReadOnlyPageController<TService, TEntityDto, TKey, PagedSortedAndFilterParameter>
    where TService : IXmsReadOnlyAppService<TEntityDto, TKey>
    where TEntityDto : IEntityDto<TKey>
{
}
public abstract class XmsReadOnlyPageController<TService, TEntityDto, TKey, TPagedParameter>
    : XmsReadOnlyPageController<TService, TEntityDto, TEntityDto, TKey, TPagedParameter>
    where TService : IXmsReadOnlyAppService<TEntityDto, TKey, TPagedParameter>
    where TEntityDto : IEntityDto<TKey>
    where TPagedParameter : class, IPagedSortedAndFilterParameter
{
}
public abstract class XmsReadOnlyPageController<TService, TDetailsResult, TPagingListResult, TKey, TPagedParameter>
    : XmsPageController<TService>
    where TService : IXmsReadOnlyAppService<TDetailsResult, TPagingListResult, TKey, TPagedParameter>
    where TDetailsResult : IEntityDto<TKey>
    where TPagingListResult : IEntityDto<TKey>
    where TPagedParameter : class, IPagedSortedAndFilterParameter
{
    [HttpGet]
    [Route("page.html")]
    public virtual Task<ViewResult> Page()
    {
        return Task.FromResult(View());
    }

    [HttpGet]
    [Route("{id}.html")]
    public virtual async Task<ViewResult> Details(TKey id)
    {
        var details = await CurrentService.GetAsync(id);
        return View(details);
    }
}

